import { SeqRouterMapHelper } from "./SeqRouterMapHelper";
import { ERMIDispatchStatus } from "./ERMIDispatchStatus";
// import { PropertyChangeEvent } from "../../mx/events/PropertyChangeEvent";
import {
  StreamDispacher,
  StreamDispacherDataType
} from "../../flash/events/StreamDispacher";
import { SerializeStream } from "../../Framework/Serialize/SerializeStream";
type int = number;
//class SRMIReturn

export class SRMIReturn extends StreamDispacher {
  constructor() {
    super([
      {
        key: "messageId",
        type: StreamDispacherDataType.Int
      },
      {
        key: "dispatchStatus"
      },
      {
        key: "userKey"
      },
      {
        key: "routerMap"
      }
    ]);
  }
  public __write(stream: SerializeStream) {
    super.__write(stream);
    this.dispatchStatus.__write(stream);
    stream.writeInt(this.userKey);
    SeqRouterMapHelper.write(stream, this.routerMap);
  }

  public __read(stream: SerializeStream) {
    super.__read(stream);
    this.dispatchStatus = ERMIDispatchStatus.__read(stream);
    this.userKey = stream.readInt();
    this.routerMap = SeqRouterMapHelper.read(stream);
  }

  public messageId!: int;
  public dispatchStatus!: ERMIDispatchStatus;
  public userKey!: int;
  public routerMap!: Array<any>;
}
